/*
 * Copyright (c) 2025 Li Auto Inc. and its affiliates
 * Licensed under the Apache License, Version 2.0(the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "Eth_GEthMac.h"
#include "veth_pbcfg.h"

void eth_gethmac_init(void)
{
	veth_init(&veth_config_set);
}

void ETH_GetPhysAddr(uint8 ctrl_idx, uint8 *phys_addr_ptr)
{
	veth_get_phys_addr(ctrl_idx, phys_addr_ptr);
}

BufReq_ReturnType ETH_ProvideTxBuffer(uint8 ctrl_idx, uint8 priority, eth_buf_idx_type *bufidx_ptr,
	eth_data_type **buf_ptr, uint16 *lenbyte_ptr)
{
	(void) priority;
	return veth_provide_tx_buffer(ctrl_idx, bufidx_ptr, buf_ptr, lenbyte_ptr);
}

Std_ReturnType ETH_Transmit(uint8 ctrl_idx, eth_buf_idx_type buf_idx, eth_frame_type frame_type,
	boolean tx_confirmation, uint16 len_byte, const uint8 *phys_addr_ptr)
{
	return veth_transmit(ctrl_idx, buf_idx, frame_type, tx_confirmation, len_byte, phys_addr_ptr);
}

void ethisr2_isr(void)
{
	veth_tx_ctrl0_irq_hdlr();
}

void ethisr6_isr(void)
{
	veth_rx_ctrl0_irq_hdlr();
}

void eth_enable_eth_mac(void)
{
}
